﻿using BLL;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 后整理管理系统.自定义类;

namespace 纺织贸易管理系统.其他窗体
{
    public partial class 检验完毕 : UIForm
    {
        public decimal Mishu { get; set; }
        public decimal Juanshu { get; set; }
        public StockTable stock { get; set; }
        private Boolean _isCancel { get; set; } = true;
        public Boolean IsCancel {
            get{ return _isCancel; } }
        public 检验完毕()
        {
            InitializeComponent();
        }

        private void 检验完毕_Load(object sender, EventArgs e)
        {
            txtkehu.Text = stock.CustomName;
            txtganghao.Text = stock.GH;
            txthetonghao.Text = stock.ContractNum;
            txtordernum.Text = stock.orderNum;
            txtmenfu.Text = stock.MF;
            txtpingming.Text = stock.PM;
            txtyanse.Text = stock.YS;
            txtkucunjuanshu.Text = stock.MS.ToString();
            txtkucunmingshu.Text = stock.JS.ToString();
            txtkezhong.Text = stock.KZ;
            txtkuanhao.Text = stock.kuanhao;
            txtchengfeng.Text = stock .CF;
            txtcangku.Text = stock.CKMC;
            txtbianhao.Text = stock.BH;
            txtguige.Text = stock.GG;
            txthuahao.Text = stock.Huahao;
            txtkehupingming.Text = stock.CustomerPingMing;
            txtkehusehao.Text = stock.CustomerColorNum;
            txtjuanshu.Text = stock.JS .ToString();
            txtmishu.Text = stock.MS.ToString();
            var rolls = new StockHelper().加载卷(stock);
            if(rolls.Count>0)
            {
                txtmishu.Text=rolls.Sum(x=>x.biaoqianmishu).ToString ();
                txtjuanshu.Text = rolls.Count.ToString ();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this._isCancel = false;
            this.Close();
        }

        private void 检验完毕_FormClosed(object sender, FormClosedEventArgs e)
        {
            Juanshu = txtjuanshu.Text.ToDecimal();
            Mishu = txtmishu.Text.ToDecimal();
        } 
    }
}
